<?php

$id = $_GET["id"];

//连接
$conn = new mysqli("localhost","root","root","db5");
if($conn->connect_error){
    die("连接失败");
}
//连接成功

//$sql = "SELECT * FROM `user`";
//查询name里面带小的字段
//$sql = "SELECT * FROM `user` WHERE `name`LIKE` '%小%' ";
//查询db5的user表中的 id=3的值
$sql = "SELECT * FROM `user` WHERE `id`=$id ";

$result = $conn->query($sql);

var_dump($result);
//再通过循环展示出来
// ...
var_dump($result->num_rows);
//如果数据库里的条数大于1
if($result->num_rows > 0){
    //有值
    //再通过循环展示出来
    //没有结果的时候是 NULL
    while($row = $result->fetch_assoc() ){
    var_dump($row["name"]);
    }
}else{
    echo "0 结果";
}

//关闭连接
$conn->close();
?>